<template>
  <div class="custom-form">
    <el-row :gutter="15">
      <el-form ref="elForm" v-loading="loadings1" :model="formData" :rules="rules" size="medium" label-width="100px" :key="showFormKey">
        <!-- 付款申请-标题 -->
        <el-col :span="24">
          <el-form-item label-width="0" prop="field100e424">
            <h2 align='center' style="color:undefined;font-size: nullpx;text-align: center">付款申请</h2>
          </el-form-item>
        </el-col>
        <!-- 当前用户 公共字段 -->
        <el-col :span="24" v-if="hasFormPermission('current_user_id')" v-show="showFlag">
          <el-form-item :label="$t('当前用户')" prop="current_user_id">
            <avue-information-body :operationVal="operationVal" infoType='user' :whetherToRebindSecondaryEditing='false'
              v-model="formData['current_user_id']" placeholder="用户当前当前用户"
              :disabled="hasDisabledPermission('current_user_id', true)"
              :readonly="!hasEditPermission('current_user_id', true)" :style="{ width: '100%' }">
            </avue-information-body>
          </el-form-item>
        </el-col>
        <!-- 职级名称 公共字段  -->
        <el-col :span="24" v-if="hasFormPermission('job')" v-show="showFlag">
          <el-form-item :label="$t('职级名称')" prop="job">
            <el-input v-model="formData['job']" placeholder="请输入职级名称" :disabled="hasDisabledPermission('job', false)"
              :readonly="!hasEditPermission('job', false)" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <!-- 角色ID 公共字段  -->
        <el-col :span="24" v-if="hasFormPermission('role_id')" v-show="showFlag">
          <el-form-item :label="$t('角色ID')" prop="role_id">
            <el-input v-model="formData['role_id']" placeholder="请输入角色ID"
              :disabled="hasDisabledPermission('role_id', false)" :readonly="!hasEditPermission('role_id', false)"
              clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 角色名称 公共字段  -->
        <el-col :span="24" v-if="hasFormPermission('role_name')" v-show="showFlag">
          <el-form-item :label="$t('角色名称')" prop="role_name">
            <el-input v-model="formData['role_name']" placeholder="请输入角色名称"
              :disabled="hasDisabledPermission('role_name', false)" :readonly="!hasEditPermission('role_name', false)"
              clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 地区 公共字段 -->
        <el-col :span="24" v-if="hasFormPermission('area')" v-show="showFlag">
          <el-form-item :label="$t('地区')" prop="area">
            <el-input v-model="formData['area']" placeholder="请输入地区" :disabled="hasDisabledPermission('area', false)"
              :readonly="!hasEditPermission('area', false)" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <!-- 申请人ID  公共字段 -->
        <el-col :span="24" v-if="hasFormPermission('user_id')" v-show="showFlag">
          <el-form-item :label="$t('申请人ID')" prop="user_id">
            <el-input v-model="formData['user_id']" placeholder="请输入申请人ID"
              :disabled="hasDisabledPermission('user_id', false)" :readonly="!hasEditPermission('user_id', false)"
              clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 申请时间 公共字段  -->
        <el-col :span="24" v-if="hasFormPermission('apply_time')" v-show="showFlag">
          <el-form-item :label="$t('申请时间')" prop="apply_time">
            <avue-information-body :operationVal="operationVal" infoType='date' :whetherToRebindSecondaryEditing='false'
              v-model="formData['apply_time']" placeholder="当前时间申请时间"
              :disabled="hasDisabledPermission('apply_time', true)" :readonly="!hasEditPermission('apply_time', true)"
              :style="{ width: '100%' }">
            </avue-information-body>
          </el-form-item>
        </el-col>
        <!-- 是否生效 公共字段 -->
        <el-col :span="24" v-if="hasFormPermission('is_effective')" v-show="showFlag">
          <el-form-item :label="$t('是否生效')" prop="is_effective">
            <el-input v-model="formData['is_effective']" placeholder="请输入是否生效"
              :disabled="hasDisabledPermission('is_effective', false)"
              :readonly="!hasEditPermission('is_effective', false)" clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 部门简称 公共字段 -->
        <el-col :span="24" v-if="hasFormPermission('depart_short_name')" v-show="showFlag">
          <el-form-item :label="$t('部门简称')" prop="depart_short_name">
            <el-input v-model="formData['depart_short_name']" placeholder="请输入部门简称"
              :disabled="hasDisabledPermission('depart_short_name', false)"
              :readonly="!hasEditPermission('depart_short_name', false)" clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 申请人名称 原有字段-->
        <el-col :span="24" v-if="hasFormPermission('user_name')">
          <el-form-item :label="$t('申请人名称')" prop="user_name">
            <el-input v-model="formData['user_name']" placeholder="请输入申请人名称"
              :disabled="hasDisabledPermission('user_name', false)" 
              :readonly="true"
              clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 部门 -->
        <el-col :span="24" v-if="hasFormPermission('depart_id')">
          <el-form-item :label="$t('部门')" prop="depart_id">
            <el-select v-model="formData['depart_id']" placeholder="请选择部门"
              :disabled="hasDisabledPermission('depart_id', false)" filterable clearable @change="Handleselect"
              :style="{ width: '100%' }">
              <el-option v-for="(item, index) in depart_idOptions" :key="index" :label="item.F_ShortName"
                :value="item.F_DepartmentId" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 支付公司选择 新增字段-->
        <el-col :span="24" >
          <el-form-item :label="$t('支付公司')" prop="F_payment_company">
            <el-select v-model="formData['F_payment_company']" placeholder="请选择支付公司"
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in paymentCompany_typeOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 适用范围 原有字段修改-->
        <el-col :span="24" v-if="hasFormPermission('use_scope')" v-show="toubiaoFlag">
          <el-form-item :label="$t('适用范围')" prop="use_scope">
            <el-select v-model="formData['use_scope']" placeholder="请选择适用范围"
              :disabled="hasDisabledPermission('use_scope', false)" filterable clearable :style="{ width: '100%' }">
              <el-option v-for="(item, index) in applyRange_typeOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 支付来源 原有字段-->
        <el-col :span="24" v-if="hasFormPermission('pay_source')">
          <el-form-item :label="$t('支付来源')" prop="pay_source">
            <el-select v-model="formData['pay_source']" placeholder="请选择支付来源"
              :disabled="hasDisabledPermission('pay_source', false)" filterable clearable :style="{ width: '100%' }">
              <el-option v-for="(item, index) in pay_sourceOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
         <!-- 付款类型 原有字段修改-->
        <el-col :span="24" v-if="hasFormPermission('pay_type')">
          <el-form-item :label="$t('付款类型')" prop="pay_type">
            <el-select v-model="formData['pay_type']" placeholder="请选择付款类型"
              :disabled="hasDisabledPermission('pay_type', false)" 
              @change="selectType"
              filterable clearable :style="{ width: '100%' }">
              <el-option v-for="(item, index) in pay_typeOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 付款申请部门 原有字段-->
        <el-col :span="24" v-if="hasFormPermission('pay_apply_depart_id')">
          <el-form-item :label="$t('付款申请部门')" prop="pay_apply_depart_id">
            <!-- <avue-input-tree v-model="formData['pay_apply_depart_id']"
              :disabled="hasDisabledPermission('pay_apply_depart_id', false)" placeholder="系统默认(公司)付款申请部门" type="tree"
              :dic="pay_apply_depart_idOptions" :style="{ width: '100%' }"></avue-input-tree> -->
              <SelectOnlyDepartment @sendData="sendData1" />
          </el-form-item>
        </el-col>
        <!-- 付款申请人 原有字段-->
        <el-col :span="24" v-if="hasFormPermission('pay_apply_user_id')">
          <el-form-item :label="$t('付款申请人')" prop="pay_apply_user_id">
            <!-- <xjr-select-user v-model="formData['pay_apply_user_id']"
              :disabled="hasDisabledPermission('pay_apply_user_id', false)" 
              :key="keyValues"
              placeholder="请选择付款申请人" v-if="showForm"
              :userIds="formData.pay_apply_user_id"></xjr-select-user> -->
              <SelectOneStaff @transmissionData="transmissionData" />
          </el-form-item>
        </el-col>
        <!-- 新增开始 -->
          <!-- 工程款项名称 -->
          <el-col :span="24" v-show="projectFlag">
            <el-form-item :label="$t('工程款项名称')">
              <el-select v-model="formData['F_project_money_name']" placeholder="请选择"
                :disabled="hasDisabledPermission('F_project_money_name', false)" filterable clearable :style="{ width: '100%' }">
                <el-option v-for="(item, index) in projectData" :key="index" :label="item.F_ItemName"
                  :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 设备款项名称 -->
          <el-col :span="24" v-show="equipmentFlag">
            <el-form-item :label="$t('设备款项名称')">
              <el-select v-model="formData['F_equipment_money_name']" placeholder="请选择"
                :disabled="hasDisabledPermission('F_equipment_money_name', false)" filterable clearable :style="{ width: '100%' }">
                <el-option v-for="(item, index) in equipmentData" :key="index" :label="item.F_ItemName"
                  :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 设备名称 -->
          <el-col :span="24" v-show="equipmentFlag">
            <el-form-item :label="$t('设备名称')">
              <el-input v-model="formData['F_equipment_name']" placeholder="请输入设备名称"
                :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <!-- 原材料款项名称 -->
          <el-col :span="24" v-show="originalMateriaFlag">
            <el-form-item :label="$t('原材料款项名称')">
              <el-select v-model="formData['F_original_material_money_name']" placeholder="请选择"
                :disabled="hasDisabledPermission('F_original_material_money_name', false)" filterable clearable :style="{ width: '100%' }">
                <el-option v-for="(item, index) in materialData" :key="index" :label="item.F_ItemName"
                  :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 服务款项名称 -->
          <el-col :span="24" v-show="serveContractFlag">
            <el-form-item :label="$t('服务款项名称')">
              <el-select v-model="formData['F_serve_money_name']" placeholder="请选择"
                :disabled="hasDisabledPermission('F_serve_money_name', false)" filterable clearable :style="{ width: '100%' }">
                <el-option v-for="(item, index) in serveData" :key="index" :label="item.F_ItemName"
                  :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 其他说明 -->
          <el-col :span="24" v-show="serveContractFlag">
            <el-form-item :label="$t('其他说明')">
              <el-input v-model="formData['F_other_description']" type="textarea" placeholder="请输入外出原因"
                :autosize="{minRows: 4, maxRows: 4}"
                :style="{width: '100%'}"></el-input>
            </el-form-item>
          </el-col>
        <!-- 新增结束 -->
        <!-- 招标项目选择 原有字段-->
        <el-col :span="24" v-if="hasFormPermission('project_id')">
          <el-form-item :label="$t('招标项目选择')" prop="project_id" v-show="this.formData['pay_type'] !=''">
            <el-input v-model="formData['project_id']" placeholder="请选择"
              :disabled="hasDisabledPermission('project_id', false)" @focus="selectApprovalForm1"
              :readonly="!hasEditPermission('project_id', false)" clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 招标项目选择-关联审批单 -->
        <el-col :span="24" v-show="selectData.length > 0">
          <el-form-item label="">
            <div class="del_items" v-for="(item, index) in selectData" :key="index">
              <div class="del-items-left"><img src="../../../assets/card/file.png"></div>
              <div class="del-items-middle">{{ item.startUser }}提交的{{ item.schemeName }}</div>
              <div class="del-items-refuse" v-if="item.status == 0">审批拒绝</div>
              <div class="del-items-adopt" v-else-if="item.status == 1">审批通过</div>
              <div class="del-items-processing" v-else>审批中</div>
              <div class="del-items-close" @click="delApproval(item, index)"><img src="../../../assets/card/close.png">
              </div>
            </div>
          </el-form-item>
        </el-col>
        <!-- 付款合同 原有字段修改-->
        <el-col :span="24" 
            v-show="(this.formData['pay_type'] == 3 || 
              this.formData['pay_type'] == 4 ||
              this.formData['pay_type'] == 5 || 
              this.formData['pay_type'] == 6) ||
              ( this.formData['pay_type'] == 7 && 
              (this.formData['F_serve_money_name'] == '1' ||
                this.formData['F_serve_money_name'] == '2' || 
                this.formData['F_serve_money_name'] == '3' ||
                this.formData['F_serve_money_name'] == '5' || 
                this.formData['F_serve_money_name'] == '6')
              )">
          <el-form-item :label="$t('付款合同')" prop="pay_contract_id">
            <el-input v-model="formData['pay_contract_id']" placeholder="请选择付款合同"
              :disabled="hasDisabledPermission('pay_contract_id', false)" @focus="selectApprovalForm2"
              :readonly="!hasEditPermission('pay_contract_id', false)" clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 付款合同-关联审批单 此字段去掉-->
        <el-col :span="24" v-show="selectData2.length > 0">
          <el-form-item label="">
            <div class="del_items" v-for="(item, index) in selectData2" :key="index">
              <div class="del-items-left"><img src="../../../assets/card/file.png"></div>
              <div class="del-items-middle">{{ item.startUser }}提交的{{ item.schemeName }}</div>
              <div class="del-items-refuse" v-if="item.status == 0">审批拒绝</div>
              <div class="del-items-adopt" v-else-if="item.status == 1">审批通过</div>
              <div class="del-items-processing" v-else>审批中</div>
              <div class="del-items-close" @click="delApproval2(item, index)"><img src="../../../assets/card/close.png">
              </div>
            </div>
          </el-form-item>
        </el-col>
        <!-- 收款账户 原有字段-->
        <el-col :span="24"
          v-if="hasFormPermission('receive_count')">
          <el-form-item :label="$t('收款账户')" prop="receive_count" v-show="this.formData['pay_type'] !=''">
            <el-input v-model="formData['receive_count']" placeholder="请输入收款账户"
              :disabled="hasDisabledPermission('receive_count', false)"
              :readonly="!hasEditPermission('receive_count', false)" clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 新增开始 -->
        <!-- 合同金额 -->
        <el-col :span="24"
            v-show="(this.formData['pay_type'] == 3 || 
            this.formData['pay_type'] == 4 || 
            this.formData['pay_type'] == 5 || 
            this.formData['pay_type'] == 6 || 
            this.formData['pay_type'] == 7) && 
            this.formData['pay_type'] !=''" 
        >
          <el-form-item :label="$t('合同金额')">
            <el-input v-model.number="formData['F_contract_amount']" placeholder="请输入合同金额"
              :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 累积已付金额（元）、 -->
        <el-col :span="24"
          v-show="(this.formData['pay_type'] == 3 || 
              this.formData['pay_type'] == 4 || 
              this.formData['pay_type'] == 5 || 
              this.formData['pay_type'] == 6 || 
              this.formData['pay_type'] == 7) && this.formData['pay_type'] !=''">
          <el-form-item :label="$t('累积已付金额')">
            <el-input v-model.number="formData['F_accumulate_paymented']" placeholder="请输入累积已付金额"
              :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 累积支付进度 -->
        <el-col :span="24"
          v-show="(this.formData['pay_type'] == 3 || 
            this.formData['pay_type'] == 4 || 
            this.formData['pay_type'] == 5 || 
            this.formData['pay_type'] == 6 || 
            this.formData['pay_type'] == 7) && this.formData['pay_type'] !=''">
          <el-form-item :label="$t('累积支付进度')">
            <el-input v-model.number="formData['F_accumulate_paymented_process']" placeholder="请输入累积支付进度"
              :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 新增结束 -->
        <!-- 支付方式 原有字段-->
        <el-col :span="24"
          v-show="this.formData['pay_type'] != 1 &&
                  this.formData['pay_type'] != 7"
          >
          <el-form-item :label="$t('支付方式')" prop="pay_pattern">
            <el-select v-model="formData['pay_pattern']" placeholder="请选择支付方式"
              :disabled="hasDisabledPermission('pay_pattern', false)" filterable clearable :style="{ width: '100%' }">
              <el-option v-for="(item, index) in pay_patternOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 付款事由 原有字段-->
        <el-col :span="24" 
          v-show="this.formData['pay_type'] != 1 &&
                  this.formData['pay_type'] != 2">
          <el-form-item :label="$t('付款事由')" prop="project_reason">
            <el-input v-model="formData['project_reason']" type="textarea" placeholder="请输入付款事由"
              :disabled="hasDisabledPermission('project_reason', false)"
              :readonly="!hasEditPermission('project_reason', false)" :autosize="{ minRows: 4, maxRows: 4 }"
              :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <!-- 新增开始 -->
        <!-- 付款比例 -->
        <el-col :span="24"
            v-show="this.formData['pay_type'] == 3 ||
                    this.formData['pay_type'] == 4 ||
                    this.formData['pay_type'] == 5 ||
                    this.formData['pay_type'] == 6 ||
                    this.formData['pay_type'] == 7  ">
          <el-form-item :label="$t('付款比例')">
            <el-input type="number" v-model="formData['F_payment_contract_percent']" 
              placeholder="请输入付款比例"
              :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 新增结束 -->
        <!-- 签署版合同/验收文件 -->
        <el-col :span="24" 
          v-show="this.formData['pay_type'] != 1 && 
                  this.formData['pay_type'] != 2 ">
          <el-form-item :label="$t('签署版合同/验收文件')" prop="file_url">
            <xjr-custom-upload :config="file_urlConfig" :disabled="hasDisabledPermission('file_url', false)"
              v-model="formData['file_url']" list-type="text"></xjr-custom-upload>
          </el-form-item>
        </el-col>
        <!-- 项目资料文件 -->
        <el-col :span="24" 
          v-show="(this.formData['pay_type'] == 3 ||
                  this.formData['pay_type'] == 4 ||
                  this.formData['pay_type'] == 6) ||
                  (this.formData['pay_type'] == 7 && 
                  this.formData['F_serve_money_name'] == '1')"
                  >
          <el-form-item :label="$t('项目资料文件')" prop="project_files">
            <el-input v-model="formData['project_files']" placeholder="请选择"
              :disabled="hasDisabledPermission('project_files', false)" @focus="selectApprovalForm3"
              :readonly="!hasEditPermission('project_files', false)" clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 关联项目资料文件 -->
        <el-col :span="24" v-show="selectData3.length > 0">
          <el-form-item label="">
            <div class="del_items" v-for="(item, index) in selectData3" :key="index">
              <div class="del-items-left"><img src="../../../assets/card/file.png"></div>
              <div class="del-items-middle">{{ item.startUser }}提交的{{ item.schemeName }}</div>
              <div class="del-items-refuse" v-if="item.status == 0">审批拒绝</div>
              <div class="del-items-adopt" v-else-if="item.status == 1">审批通过</div>
              <div class="del-items-processing" v-else>审批中</div>
              <div class="del-items-close" @click="delApproval3(item, index)"><img src="../../../assets/card/close.png">
              </div>
            </div>
          </el-form-item>
        </el-col>
        <!-- 电子发票 -->
        <el-col :span="24" 
          v-show="this.formData['pay_type'] == 3 || 
                  this.formData['pay_type'] == 4 ||
                  this.formData['pay_type'] == 5"
        >
          <el-form-item :label="$t('电子发票')" prop="electronic_invoice">
            <el-upload action="" multiple ref="fileupload" class="upload-demo"
                    :on-change="fileChange"
                    :on-remove="upLoadRemove"
                    :http-request="uploadFile1">
                  <el-button slot="trigger" size="small" type="primary">点击上传</el-button>
                  <el-tooltip class="item" effect="dark" :content="contents" placement="top">
                    <el-button style="margin-left: 10px;" size="small" @click="uploadFileAxios">
                      开始识别<i class="el-icon-question el-icon--right"></i>
                    </el-button>
                  </el-tooltip>
                  <div slot="tip" class="el-upload__tip">只能上传图片或pdf，最多不能超过10张，总大小不超过20M</div>
                </el-upload>
            </el-form-item>
        </el-col>
        <!-- 发票详情 -->
        <el-col :span="24" 
                v-show="this.formData['pay_type'] == 3 || 
                  this.formData['pay_type'] == 4 ||
                  this.formData['pay_type'] == 5">
          <el-form-item :slot="label">
            <el-tooltip class="item marginleft" effect="dark" :content="contents1" placement="top">
              <label> <i class="el-icon-question"></i>智能识别发票内容</label>
            </el-tooltip>
            <div class="table-box">
                <div class="table-header">
                    <div class="table-header-items width100">序号</div>
                    <div class="table-header-items width200"><span class="required">*</span>是否需要验真</div>
                    <div class="table-header-items width200"><span class="required">*</span>验真结果</div>
                    <div class="table-header-items width200"><span class="required">*</span>是否重复</div>
                    <div class="table-header-items width200"><span class="required">*</span>发票代码</div>
                    <div class="table-header-items width200"><span class="required">*</span>发票号码</div>
                    <div class="table-header-items width200"><span class="required">*</span>开票日期</div>
                    <!-- <div class="table-header-items width200"><span class="required">*</span>发票类型</div> -->
                    <div class="table-header-items width200"><span class="required">*</span>发票校验码</div>
                    <div class="table-header-items width200"><span class="required">*</span>发票金额</div>
                    <div class="table-header-items width200">操作</div>
                </div>
                <div class="table-body" v-for="(item,index) in formData.invoiceDetails" :key="index">
                    <div class="table-header-items width100">{{index+1}}</div>
                    <!-- 是否需要验真 -->
                    <div class="table-header-items width200">
                      <div class="textaligncenter needs" v-if="item.need_check == '1'">需要</div>
                      <div class="textaligncenter no-needs" v-else-if="item.need_check =='2'">不需要</div>
                      <div class="textaligncenter" v-else></div>
                    </div>
                    <!-- 验真结果 -->
                    <div class="table-header-items width200" v-if="item.need_check == 1">
                      <div class=" flex_1" v-if="item.check_pass=='1'">
                        <div class="left1">验证通过</div>
                        <div class="right1"><img src="../../../assets/flowlist/effective.png"></div>
                      </div>
                      <div class="flex_1" v-else-if="item.check_pass=='2'">
                        <div class="left1">验证不通过</div>
                        <div class="right1"><img src="../../../assets/flowlist/invalid.png"></div>
                      </div>
                      <div class="flex_1" v-else>
                        <div class="left1"></div>
                        <div class="right1"></div>
                      </div>
                    </div>
                    <div class="table-header-items width200" v-else-if="item.need_check == 2">--</div>
                    <div class="table-header-items width200" v-else></div>
                    <!-- 是否重复（系统内） -->
                    <div class="table-header-items width200">
                      <div class=" flex_1" v-if="item.used=='1'">
                        <div class="left1">重复</div>
                        <div class="right1"><img src="../../../assets/flowlist/repeat.png"></div>
                      </div>
                      <div class="flex_1" v-else-if="item.used=='0'">
                        <div class="left1">不重复</div>
                        <div class="right1"><img src="../../../assets/flowlist/no-repeat.png"></div>
                      </div>
                      <div class="flex_1" v-else>
                        <div class="left1"></div>
                        <div class="right1"></div>
                      </div>
                    </div>
                    <div class="table-header-items width200"><el-input class="el-inputs_" placeholder="请输入" v-model="item.invoice_code"></el-input></div>
                    <div class="table-header-items width200"><el-input class="el-inputs_" placeholder="请输入" v-model="item.invoice_num"></el-input></div>
                    <div class="table-header-items width200"><el-input class="el-inputs_" placeholder="请输入" v-model="item.invoice_date"></el-input></div>
                    <!-- <div class="table-header-items width200"><el-input class="el-inputs_" placeholder="请输入" v-model="item.inv
                    oice_des"></el-input></div> -->
                    <div class="table-header-items width200"><el-input class="el-inputs_" placeholder="请输入" v-model="item.check_code"></el-input></div>
                    <div class="table-header-items width200"><el-input class="el-inputs_" placeholder="请输入" v-model="item.total_amount"></el-input></div>
                    <div class="table-header-items width200">
                        <el-link type="danger" @click="delInvoice(index)">删除</el-link>
                    </div>
                </div>
            </div>
          </el-form-item>
        </el-col>
        <!-- 付款金额 -->
        <el-col :span="24" v-if="hasFormPermission('pay_money')">
          <el-form-item :label="$t('付款金额')" prop="pay_money" v-show="this.formData['pay_type'] != ''">
            <el-input v-model="formData['pay_money']" type="number" placeholder="请输入付款金额"
              :disabled="hasDisabledPermission('pay_money', false)" :readonly="!hasEditPermission('pay_money', false)"
              clearable :style="{ width: '100%' }">
              <template slot="append">元</template>
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 大写 -->
        <el-col :span="24">
          <el-form-item :label="$t('大写')" v-show="formData['pay_money'] > 0">
            <div style="color:#0063f5">{{ convertCurrency(formData['pay_money']) }}</div>
          </el-form-item>
        </el-col>
        <!-- 收票管理 -->
        <el-col :span="24" 
          v-show="this.formData['pay_type'] == 3 ||
                  this.formData['pay_type'] == 4 ||
                  this.formData['pay_type'] == 5 "
          >
          <el-form-item :label="$t('收票管理')" prop="receive_ticket_manager">
            <el-input v-model="formData['receive_ticket_manager']" placeholder="请输入收票管理"
              :disabled="hasDisabledPermission('receive_ticket_manager', false)" @focus="handleSetProject"
              :readonly="!hasEditPermission('receive_ticket_manager', false)" clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 关联收票管理 -->
        <el-col :span="24" v-show="dataVal.startUser">
          <el-form-item label="">
            <!-- processing、refuse、adopt -->
            <div class="del_items">
              <div class="del-items-left"><img src="../../../assets/card/file.png"></div>
              <div class="del-items-middle">{{ dataVal.startUser }}提交的{{ dataVal.schemeName }}</div>
              <div class="del-items-refuse" v-if="dataVal.status == 0">审批拒绝</div>
              <div class="del-items-adopt" v-else-if="dataVal.status == 1">审批通过</div>
              <div class="del-items-processing" v-else>审批中</div>
              <div class="del-items-close" @click="delVoice"><img src="../../../assets/card/close.png"></div>
            </div>
          </el-form-item>
        </el-col>
        <!-- 缴费通知单 -->
        <el-col :span="24" 
          v-show="(this.formData['pay_type'] == 2 || 
                  this.formData['pay_type'] == 8
              ) ||
              (
                this.formData['pay_type'] == 7 &&
                (this.formData['F_serve_money_name'] == '2' ||
                this.formData['F_serve_money_name'] == '3' ||
                this.formData['F_serve_money_name'] == '4' ||
                this.formData['F_serve_money_name'] == '5')
                )
              ">
          <el-form-item :label="$t('缴费通知单')" prop="notice_card_file_url">
            <xjr-custom-upload :config="notice_card_file_urlConfig"
              :disabled="hasDisabledPermission('notice_card_file_url', false)"
              v-model="formData['notice_card_file_url']" list-type="text"></xjr-custom-upload>
          </el-form-item>
        </el-col>
        <!-- 其他说明 此字段去掉-->
        <el-col :span="24" v-if="hasFormPermission('other_desc')">
          <el-form-item :label="$t('其他说明')" prop="other_desc" v-show="false">
            <el-input v-model="formData['other_desc']" placeholder="请输入其他说明"
              :disabled="hasDisabledPermission('other_desc', false)" :readonly="!hasEditPermission('other_desc', false)"
              clearable :style="{ width: '100%' }">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 款项名称 此字段去掉-->
        <el-col :span="24" v-if="hasFormPermission('project_name')">
          <el-form-item :label="$t('款项名称')" prop="project_name" v-show="false">
            <el-select v-model="formData['project_name']" placeholder="请选择款项名称"
              :disabled="hasDisabledPermission('project_name', false)" filterable clearable :style="{ width: '100%' }">
              <el-option v-for="(item, index) in project_nameOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 意见簿 -->
        <el-col :span="24" v-if="hasWorkFlowFormPermission('field1200cc4')" v-show="optionsFlag">
          <el-form-item :label="$t('意见簿')" prop="field1200cc4">
            <xjr-opinion-comonent :value="formData.field1200cc4"></xjr-opinion-comonent>
          </el-form-item>
        </el-col>
        <!-- 按钮 -->
        <el-col :span="24" v-if="!isWorkflowForm">
          <el-form-item size="large" v-if="isEdit">
            <el-button type="primary" @click="submitForm" :loading="submitLoading">
              {{ submitLoading ? $t('workFlow.WFMenu.hintSubmit') : $t('submit') }}</el-button>
            <el-button @click="cancelForm">{{ $t('cancelText') }}</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
    <!-- 招标项目选择 -->
    <el-dialog append-to-body title="关联审批单" :visible.sync="approvalFormVisible" width="880px"
      :before-close="handleClose">
      <PayApproval ref='approval' />
      <span slot="footer" class="dialog-footer">
        <div class="height16"></div>
        <el-button @click="approvalFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="sure">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 付款合同 -->
    <el-dialog append-to-body title="关联审批单" :visible.sync="approvalFormVisible2" width="880px"
      :before-close="handleClose">
      <PayApproval2 ref="approval2" />
      <span slot="footer" class="dialog-footer">
        <div class="height16"></div>
        <el-button @click="approvalFormVisible2 = false">取 消</el-button>
        <el-button type="primary" @click="sure2">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 项目资料文件 -->
    <el-dialog append-to-body title="关联审批单" :visible.sync="approvalFormVisible3" width="880px"
      :before-close="handleClose">
      <PayApproval3 ref="approval3" />
      <span slot="footer" class="dialog-footer">
        <div class="height16"></div>
        <el-button @click="approvalFormVisible3 = false">取 消</el-button>
        <el-button type="primary" @click="sure3">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 收票管理 -->
    <el-dialog title="选择收票管理" :visible.sync="setPeojectDialogVisible" width="800px" append-to-body
      :before-close="handleClose">
      <PayApprovalVoice @value="sendData">
      </PayApprovalVoice>
      <span slot="footer" class="dialog-footer">
        <el-button @click="setPeojectDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="sureVoice">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
  import FilterableDataList from '@/components/generator/clientComponents/FilterableDataList.vue';
  import workflowFormAuthorize from "@/mixins/workflowFormAuthorize";
  import authorizeMixin from "@/mixins/authorize";
  import { baseUrl } from "@/config/env";
  import request from "@/router/axios";
  import { v4 as uuidv4 } from "uuid";
  import {distInvoice}from '@/api/user.js';
  import PayApproval from '../components/payApproval.vue'
  import PayApproval2 from '../components/payApproval2.vue'
  import PayApproval3 from '../components/payApproval3.vue'
  import { getUserDetailsById } from '@/api/user.js';
  import PayApprovalVoice from '../components/payApprovalVoice.vue';
  import SelectOneStaff from '@/components/staffSelector/selectOneStaff.vue'
  import SelectOnlyDepartment from '@/components/staffSelector/selectOnlyDepartment.vue'
export default {
  mixins: [authorizeMixin, workflowFormAuthorize],
  components: { PayApproval, PayApproval2, PayApproval3, PayApprovalVoice,SelectOneStaff,SelectOnlyDepartment },
  props: ['keyValue', 'isEdit', 'disabled'],
  data() {
    let _this = this
    return {
      fileList:[],
      submitLoading: false,
      showForm: true,
      showFormKey: 1,
      reRenderSubform: false,
      operationVal: 'add',
      isAdd: true,
      addressUrl: 'payapplyapproval',
      mainTableName: 'pay_apply',
      formConfig: {},
      keyValues:987458741,
      formData: {
        'field100e424': '',
        'job': '',
        'role_id': '',
        'role_name': '',
        'area': '',
        'user_id': '',
        'apply_time': '',
        'user_name': '',
        'depart_short_name': '',
        'depart_id': '',
        'current_user_id': '',
        'is_effective': '0',
        'pay_source': '',//支付来源
        'pay_money': 0,
        'pay_type': "",
        'pay_apply_depart_id': '',
        'pay_apply_user_id': '',
        'project_id': '',
        'file_url': null,
        'receive_count': '',
        'other_desc': '123',//默认值去掉这个字段
        'pay_pattern': '',
        'notice_card_file_url': null,
        'use_scope': '',// 适用范围
        'pay_contract_id': '',//默认值去掉这个字段
        'project_name': '1',//默认值去掉这个字段
        'project_reason': '',
        'project_files': '',
        'electronic_invoice': '',
        'receive_ticket_manager': '',
        'field1200cc4': null,
        invoiceDetails:[
          {
            invoice_code:'',//发票代码
              invoice_num:'',//发票号码
              invoice_date:'',//开票日期
              invoice_des:'',//发票类型
              check_code:'',//发票校验码
              total_amount:'',//发票金额
              check_pass:'0',//验证是否通过
              check_result:'',//验证结果
              need_check:'',//是否需要验证
              used:'2',//验重
          }
        ],
        // 新增字段
        F_payment_company:'',// 支付公司选择
        F_project_money_name:'',//工程款项名称
        F_equipment_money_name:'',//设备款项名称
        F_equipment_name:'',//设备名称
        F_original_material_money_name:'',//原材料款项名称
        F_serve_money_name:'',//服务款项名称
        F_other_description:'',//其他说明
        F_payment_contract:'',//付款合同
        F_contract_amount:'',//合同金额
        F_accumulate_paymented:'',//累积已付款（元）
        // F_accumulate_paymented_process:'',//累积支付进度
        F_payment_contract_percent:'',//付款比例
      },
      rules: {
        job: [{
          required: true,
          message: '请输入职级名称',
          trigger: 'blur'
        }],
        role_id: [{
          required: true,
          message: '请输入角色ID',
          trigger: 'blur'
        }],
        role_name: [{
          required: true,
          message: '请输入角色名称',
          trigger: 'blur'
        }],
        area: [{
          required: true,
          message: '请输入地区',
          trigger: 'blur'
        }],
        user_id: [{
          required: true,
          message: '请输入申请人ID',
          trigger: 'blur'
        }],
        user_name: [{
          required: true,
          message: '请输入申请人名称',
          trigger: 'blur'
        }],
        depart_short_name: [{
          required: true,
          message: '请输入部门简称',
          trigger: 'blur'
        }],
        depart_id: [{
          required: true,
          message: '请选择部门ID',
          trigger: 'change'
        }],
        is_effective: [{
          required: true,
          message: '请输入是否生效',
          trigger: 'blur'
        }],
        F_payment_company:[{
          required: true,
          message: '请选择支付公司',
          trigger: 'change'
        }],
        pay_source: [{
          required: true,
          message: '请选择支付来源',
          trigger: 'change'
        }],
        pay_money: [{
          required: true,
          message: '请输入付款金额',
          trigger: 'change'
        }],
        pay_type: [{
          required: true,
          message: '请选择付款类型',
          trigger: 'change'
        }],
        pay_apply_depart_id: [{
          required: true,
          message: '请选择付款申请部门',
          trigger: 'blur'
        }],

        pay_apply_user_id: [{
          required: true,
          message: '请选择付款申请人',
          trigger: 'blur'
        }],

        project_id: [{
          required: true,
          message: '请输入招标项目选择',
          trigger: 'change'
        }],
        file_url: [{
          required: false,
          message: '签署版合同/验收文件不能为空',
          trigger: 'change'
        }],
        receive_count: [{
          required: true,
          message: '请输入收款账户',
          trigger: 'blur'
        }],
        other_desc: [{
          required: false,
          message: '请输入其他说明',
          trigger: 'blur'
        }],
        pay_pattern: [{
          required: false,
          message: '请选择支付方式',
          trigger: 'change'
        }],
        notice_card_file_url: [{
          required: false,
          message: '缴费通知单不能为空',
          trigger: 'change'
        }],
        use_scope: [{
          required: false,
          message: '请选择适用范围',
          trigger: 'change'
        }],
        pay_contract_id: [{
          required: false,
          message: '请选择付款合同',
          trigger: 'change'
        }],
        project_name: [{
          required: false,
          message: '请选择款项名称',
          trigger: 'change'
        }],
        project_reason: [{
          required: false,
          message: '请输入付款事由',
          trigger: 'blur'
        }],
        project_files: [{
          required: false,
          message: '请输入项目资料文件',
          trigger: 'change'
        }],
        electronic_invoice: [{
          required: false,
          message: '请输入电子发票',
          trigger: 'blur'
        }],
        receive_ticket_manager: [{
          required: false,
          message: '请输入收票管理',
          trigger: 'change'
        }],
      },
      approvalFormVisible: false,
      selectData: [],
      approvalFormVisible2: false,
      selectData2: [],
      approvalFormVisible3: false,
      selectData3: [],
      // 售票管理
      setPeojectDialogVisible: false,
      dataVal: {},
      // end
      depart_idOptions: [],
      pay_sourceOptions: [],
      paymentCompany_typeOptions:[],
      pay_typeOptions: [],
      projectData:[],
      equipmentData:[],
      materialData:[],
      serveData:[],
      pay_apply_depart_idOptions: undefined,
      pay_apply_user_idOptions: undefined,
      file_urlConfig: {
        "showTip": false,
        "fileSize": 2,
        "sizeUnit": "MB",
        "buttonText": "点击上传",
        "disabled": false
      },
      electronic_invoice: {
        "showTip": false,
        "fileSize": 2,
        "sizeUnit": "MB",
        "buttonText": "点击上传",
        "disabled": false
      },
      pay_patternOptions: [],
      notice_card_file_urlConfig: {
        "showTip": false,
        "fileSize": 2,
        "sizeUnit": "MB",
        "buttonText": "点击上传",
        "disabled": false
      },
      applyRange_typeOptions:[],
      project_nameOptions: [],
      contents:'点击开始识别，系统将自动进行发票识别，并将识别的结果统计到发票内容的表格中',
      contents1:'由于文件清晰度不同，可能会存在部分发票无法识别的情况，该识别结果仅供参考',
      loadings1:false,
      showFlag:false,
      toubiaoFlag:true,
      projectFlag:false,
      equipmentFlag:false,
      originalMateriaFlag:false,
      serveContractFlag:false,
    }
  },
  computed: {
    F_accumulate_paymented_process(){
        let {F_accumulate_paymented, F_contract_amount} = this.formData
      return {F_accumulate_paymented, F_contract_amount}
    }
  },
  watch: {
    'formData.pay_money': function (val, oldVal) {
      this.changeFormConfigDefaultValue();
    },
    F_accumulate_paymented_process(val){
      if(val.F_accumulate_paymented && val.F_contract_amount){
        this.formData['F_accumulate_paymented_process'] = (val.F_accumulate_paymented/val.F_contract_amount).toFixed(2)
      }
    }
  },
  created() {
    this.formConfig = this.getFormConfig();
  },
  async mounted() {
    //TODO 再这里做数据回填 请求表单数据
    if (this.keyValue) {
      this.isAdd = false;
    }
    this.keyValues++
    if (!this.isAdd && this.keyValue) {
      this.operationVal = 'edit';
      try {
        let res = await request({
          url: baseUrl + "/" + this.addressUrl + "/" + this.keyValue,
          method: "get",
        });

        this.formData = res.data.data

        this.showFormKey++;
      } catch (error) {
      }
    }
    if (typeof this.getPay_sourceOptions == "function") {
      await this.getPay_sourceOptions();
    }
    if (typeof this.getPay_typeOptions == "function") {
      await this.getPay_typeOptions();
    }
    if (typeof this.getPay_projectData == "function") {
      await this.getPay_projectData();
    }
    if (typeof this.getPay_equipmentData == "function") {
      await this.getPay_equipmentData();
    }
    if (typeof this.getPay_materialData == "function") {
      await this.getPay_materialData();
    }
    if (typeof this.getPay_serveData == "function") {
      await this.getPay_serveData();
    }
    if (typeof this.getPay_apply_depart_idOptions == "function") {
      await this.getPay_apply_depart_idOptions();
    }
    if (typeof this.getPay_patternOptions == "function") {
      await this.getPay_patternOptions();
    }
    //获取支付公司字典数据
    if (typeof this.getPaymentCompany_idOptions == "function") {
      await this.getPaymentCompany_idOptions();
    }
    if (typeof this.getProject_nameOptions == "function") {
      await this.getProject_nameOptions();
    }
    //获取适用范围字典数据
    if (typeof this.getApplyRange_idOptions == "function") {
      await this.getApplyRange_idOptions();
    }
    await this.getUserInfo()
  },
  methods: {
    async getApplyRange_idOptions() {
        // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
        try {
          let resp = await this.$axios({
            method: 'get',
            url:  baseUrl + '/data-items/zm-range/detail',
          });
          if (resp.data.data) {
            this.applyRange_typeOptions = resp.data.data;
          }
        }
        catch (error) {}
    },
    async getPaymentCompany_idOptions() {
        // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
        try {
          let resp = await this.$axios({
            method: 'get',
            url:  baseUrl + '/data-items/zm-payment-company/detail',
          });
          if (resp.data.data) {
            this.paymentCompany_typeOptions = resp.data.data;
          }
        }
        catch (error) {}
    },
    sendData1(value){
        this.formData['pay_apply_depart_id'] = value
    },
    selectOnePerson(){
      console.log('selectOnePerson');
    },
    delInvoice(index){
      this.formData.invoiceDetails.splice(index,1)
    },
    uploadFileAxios(){
        this.loadings1 = true
        let _this = this
        this.folderId = uuidv4()
        var form = new FormData();//new一个表单对象
        if(this.fileList && this.fileList.length > 0){
          this.fileList.forEach(e =>{
            form.append("file",e.raw)
          })
          axios({
            method: 'post',
            url:`${baseUrl}/upload/oss/${_this.folderId}/batch`,
            headers: {'Content-Type': 'multipart/form-data'},
            data:form
          }).then(res => {
            console.log('res:==',res);
            if(res.data && res.data.success){
              this.analysis(res.data.data)
            }
          })
        }else{
          this.loadings1 = false
          this.$message.warning("请先上传发票")
        }
    },
    analysis(files){
      let data = []
      let result
      if(files && files.length > 0){
        files.forEach(e=>{
          data.push(e.fileId)
        })
      }
      distInvoice(data).then(res => {
        if(res.data && res.data.success){
          this.loadings1 = false
          if(res.data.data){
            this.formData['pay_money'] = res.data.data.total_amount
            this.formData.invoiceDetails = res.data.data.list
          }
        }else{
          this.loadings1 = false
        }
      })
    },
    fileChange(file){
      //判断上传文件数量
      if(this.fileList.indexOf(file) == -1){
        this.fileList.push(file);
      }
      
      return false;
    },
    upLoadRemove(file) {
        let tempFileList = [];
        for (var index = 0; index < this.fileList.length; index++) {
          if (this.fileList[index].name !== file.name) {
            tempFileList.push(this.fileList[index]);
          }
        }
        this.fileList = tempFileList;
    },
    uploadFile1(){},
    handleSetProject() {
      this.setPeojectDialogVisible = true
    },
    getUserInfo() {
      let params = {
        userId: this.formData['current_user_id']
      }
      getUserDetailsById(params).then(res => {
        if (res.data.success) {
          this.formData['job'] = res.data.data.F_Job
          this.formData['area'] = res.data.data.F_Area
          this.formData['user_id'] = this.formData['current_user_id']
          this.formData['user_name'] = res.data.data.F_RealName
          this.depart_idOptions = res.data.data.F_Department
          this.roleData = res.data.data.F_Role
          this.initRole()
          this.initDepartmentData()
        }
      })
    },
    initDepartmentData(){
      if(this.depart_idOptions && this.depart_idOptions.length == 1){
        this.formData['depart_short_name'] = this.depart_idOptions[0].F_FullName
        this.formData['depart_id'] = this.depart_idOptions[0].F_DepartmentId
      }
    },
    Handleselect() {
      if (this.depart_idOptions && this.depart_idOptions.length > 0) {
        this.depart_idOptions.forEach(e => {
          if (e.F_DepartmentId == this.formData['depart_id']) {
            this.formData['depart_short_name'] = e.F_ShortName
          }
        })
      }
    },
    initRole() {
      let roleId = []
      let roleName = []
      if (this.roleData && this.roleData.length > 0) {
        this.roleData.forEach(e => {
          roleId.push(e.F_RoleId)
          roleName.push(e.F_FullName)
        })
      }
      this.formData['role_id'] = roleId.join(',')
      this.formData['role_name'] = roleName.join(',')
    },
    convertCurrency(money) {
      //汉字的数字
      var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
      //基本单位
      var cnIntRadice = new Array('', '拾', '佰', '仟');
      //对应整数部分扩展单位
      var cnIntUnits = new Array('', '万', '亿', '兆');
      //对应小数部分单位
      var cnDecUnits = new Array('角', '分', '毫', '厘');
      //整数金额时后面跟的字符
      var cnInteger = '整';
      //整型完以后的单位
      var cnIntLast = '元';
      //最大处理的数字
      var maxNum = 999999999999999.9999;
      //金额整数部分
      var integerNum;
      //金额小数部分
      var decimalNum;
      //输出的中文金额字符串
      var chineseStr = '';
      //分离金额后用的数组，预定义
      var parts;
      // 传入的参数为空情况 
      if (money == '') return ''
      money = parseFloat(money)
      if (money >= maxNum) return ''
      // 传入的参数为0情况 
      if (money == 0) {
        chineseStr = cnNums[0] + cnIntLast + cnInteger;
        return chineseStr
      }
      // 转为字符串
      money = money.toString();
      // indexOf 检测某字符在字符串中首次出现的位置 返回索引值（从0 开始） -1 代表无
      if (money.indexOf('.') == -1) {
        integerNum = money;
        decimalNum = ''
      } else {
        parts = money.split('.');
        integerNum = parts[0];
        decimalNum = parts[1].substr(0, 4);
      }
      //转换整数部分
      if (parseInt(integerNum, 10) > 0) {
        let zeroCount = 0;
        let IntLen = integerNum.length
        for (let i = 0; i < IntLen; i++) {
          let n = integerNum.substr(i, 1);
          let p = IntLen - i - 1;
          let q = p / 4;
          let m = p % 4;
          if (n == '0') {
            zeroCount++;
          } else {
            if (zeroCount > 0) {
              chineseStr += cnNums[0]
            }
            zeroCount = 0;
            chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
          }
          if (m == 0 && zeroCount < 4) {
            chineseStr += cnIntUnits[q];
          }
        }
        // 最后+ 元
        chineseStr += cnIntLast;
      }
      // 转换小数部分
      if (decimalNum != '') {
        let decLen = decimalNum.length;
        for (let i = 0; i < decLen; i++) {
          let n = decimalNum.substr(i, 1);
          if (n != '0') {
            chineseStr += cnNums[Number(n)] + cnDecUnits[i]
          }
        }
      }
      if (chineseStr == '') {
        chineseStr += cnNums[0] + cnIntLast + cnInteger;
      } else if (decimalNum == '') {
        chineseStr += cnInteger;
      }
      return chineseStr
    },
    getFormData() {
      let key = this.mainTableName + 'Entity';
      let returnParams = {};
      returnParams[key] = this.formData;
      return {
        ...returnParams,
      };
    },
    validateForm() {
      this.$refs['elForm'].validate(valid => { });
    },
    async aysncValidateForm() {
      let validataArry = []
      validataArry.push(new Promise((resolve, reject) => {
        this.$refs['elForm'].validate(valid => {
          resolve(valid)
        })
      }))
      let res = await Promise.all(validataArry)
      if (res.includes(false)) {
        return false
      }
      else {
        return true;
      }
    },
    changeTableData() { },
    async submitForm() {
      this.submitLoading = true;
      let valid = await this.aysncValidateForm();
      if (valid == false) {
        this.submitLoading = false;
        return false;
      }
      this.changeTableData();
      //格式化数据
      let newObj = this.getFormData();

      //如果没有传入参数就是新增
      if (!this.keyValue) {

        request({
          url: baseUrl + "/" + this.addressUrl,
          method: "post",
          data: newObj
        }).then((res) => {
          this.submitLoading = false;
          this.$notify({
            title: "成功",
            message: "新增成功",
            type: "success",
          });
          this.$emit("onChange", true)
        });

      }
      else {

        request({
          url: baseUrl + "/" + this.addressUrl + "/" + this.keyValue,
          method: "put",
          data: newObj
        }).then((res) => {
          this.submitLoading = false;
          this.$notify({
            title: "成功",
            message: "修改成功",
            type: "success",
          });
          this.$emit("onChange", true)
        });

      }



    },
    cancelForm() {
      this.$emit("onChange", true)
    },
    formatTree(data, valueField, lableField, childField, type) {
      let tree = [];
      data.forEach((node, index) => {
        let newNode = {
          value: node[valueField],
          label: node[lableField],
        };
        if (type) {
          newNode.disabled = node[valueField] == undefined ? true : false
        }
        tree.push(newNode);
        if (node[childField] != null && node[childField].length > 0) {
          newNode.children = (this.formatTree(node[childField], valueField, lableField, childField,
            type));
        }
      }, this);
      return tree;
    },
    //辅助工作流 审批(编辑) 预留方法
    handleEdit() {
    },
    getNumberFixed2(number) {
      let splitNum = ("" + number).replace(/(^0*)/g, "").split(".");
      let num = splitNum[0] == "" ? '0' : splitNum[0];
      if (splitNum.length > 1) {
        num += '.';
        let roundNum = 2; //保留两位小数
        for (let i = 0; i < roundNum; i++) {
          num += splitNum[1][i];
        }
      }
      return parseFloat(num);
    },
    changeFormConfigDefaultValue() {
      let valueForFormIdMap = new Map();
      this.formConfig.fields.forEach((ele) => {
        if (ele.__config__.componentName == "table") {
          ele.__config__.children.forEach((element) => {
            valueForFormIdMap.set(ele.__config__.formId + "-table-" + element.__config__.formId,
              element.__config__.defaultValue);
          });
        }
        else if (ele.__config__.componentName && ele.__config__.componentName == 'avue-tabs') {
          let childrenObj = ele.__config__.childrenObj || {};
          let _arr = this.getValByTabs(childrenObj);
          _arr.map(item => {
            valueForFormIdMap.set(item.formId, item.defaultValue);
          });
        }
        else {
          valueForFormIdMap.set(ele.__config__.formId, this.formData[ele.__vModel__]);
        }
      });
      this.formConfig.fields.forEach((ele, index) => {
        if (ele.__config__.componentName == "table") {
          ele.__config__.children.forEach((element, childrenIndex) => {
            let defaultValue = 0;
            if (element.computationalConfiguration && element.computationalConfiguration.length > 0) {
              let formulaStr = "";
              element.computationalConfiguration.forEach((item) => {
                if (item.type == "taxRate") {
                  //税率
                  if (element.taxRate >= 0) {
                    formulaStr += element.taxRate * 0.01;
                  }
                }
                else {
                  let eleValue = valueForFormIdMap.get(item.formId) || 0;
                  formulaStr += item.formId == 0 ? item.name : eleValue;
                }
              });
              defaultValue = eval(formulaStr);
              defaultValue = this.getNumberFixed2(defaultValue);
              //大写
              if (element.isCapitalized) {
                this.formConfig.fields[index].__config__.children[childrenIndex].__config__
                  .capitalizedValue = this.getCapitalizedMethod(defaultValue);
              }
              this.formConfig.fields[index].__config__.children[childrenIndex].__config__
                .defaultValue = defaultValue;
              this.formData[element.__vModel__] = defaultValue;
            }
          });
        }
        else if (ele.__config__.componentName && ele.__config__.componentName == 'avue-tabs') {
          let childrenObj = ele.__config__.childrenObj || {};
          //avue-tabs
          this.calcDefaultValueByTabs(ele.__config__.childrenObj, valueForFormIdMap);
        }
        else {
          let defaultValue = 0;
          if (ele.computationalConfiguration && ele.computationalConfiguration.length > 0) {
            let formulaStr = "";
            ele.computationalConfiguration.forEach((item) => {
              if (item.type == "taxRate") {
                //税率
                if (ele.taxRate >= 0) {
                  formulaStr += ele.taxRate * 0.01;
                }
              }
              else {
                let eleValue = valueForFormIdMap.get(item.formId) || 0;
                formulaStr += item.formId == 0 ? item.name : eleValue;
              }
            });
            defaultValue = eval(formulaStr);
            defaultValue = this.getNumberFixed2(defaultValue);
            //大写
            if (ele.isCapitalized) {
              this.formConfig.fields[index].__config__.capitalizedValue = this.getCapitalizedMethod(
                defaultValue);
            }
            this.formConfig.fields[index].__config__.defaultValue = defaultValue;
            this.formData[ele.__vModel__] = defaultValue;
          }
        }
      });
    },
    getValByTabs(childrenObj) {
      let _arr = [];
      if (!childrenObj || !(childrenObj instanceof Object)) return [];
      for (let key in childrenObj) {
        let children = childrenObj[key];
        children.map(item => {
          if (item.__config__.componentName && item.__config__.componentName == 'avue-tabs') {
            let cObj = item.__config__.childrenObj || {};
            _arr.push(...this.getValByTabs(item.__config__.childrenObj));
          }
          else {
            let _obj = {};
            _obj.formId = item.__config__.formId;
            _obj.defaultValue = this.formData[item.__vModel__];
            _arr.push(_obj);
          }
        });
      }
      return (() => {
        return _arr;
      })()
    },
    calcDefaultValueByTabs(childrenObj, valueForFormIdMap) {
      if (!childrenObj || !(childrenObj instanceof Object)) return;
      for (let key in childrenObj) {
        let children = childrenObj[key];
        children.map(item => {
          if (item.__config__.componentName && item.__config__.componentName == 'avue-tabs') {
            let cObj = item.__config__.childrenObj || {};
            this.calcDefaultValueByTabs(cObj, valueForFormIdMap);
          }
          else {
            let defaultValue = 0;
            if (item.computationalConfiguration && item.computationalConfiguration.length > 0) {
              let formulaStr = "";
              item.computationalConfiguration.forEach((c) => {
                if (item.type == "taxRate") {
                  //税率
                  if (item.taxRate >= 0) {
                    formulaStr += item.taxRate * 0.01;
                  }
                }
                else {
                  let eleValue = valueForFormIdMap.get(c.formId) || 0;
                  formulaStr += c.formId == 0 ? c.name : eleValue;
                }
              });
              defaultValue = eval(formulaStr);
              defaultValue = this.getNumberFixed2(defaultValue);
              item.__config__.defaultValue = defaultValue;
              this.formData[item.__vModel__] = defaultValue;
            }
          }
        });
      }
    },
    async getPay_sourceOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/data-items/zfly/detail',
        });
        if (resp.data.data) {
          this.pay_sourceOptions = resp.data.data;
        }
      }
      catch (error) { }
    },
    async getPay_typeOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/data-items/zm-pay-type/detail',
        });
        if (resp.data.data) {
          this.pay_typeOptions = resp.data.data;
        }
      }
      catch (error) { }
    },
    // projectData
    async getPay_projectData() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/data-items/project-funds-name/detail',
        });
        if (resp.data.data) {
          this.projectData = resp.data.data;
        }
      }
      catch (error) { }
    },
    async getPay_equipmentData() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/data-items/equipment-funds-name/detail',
        });
        if (resp.data.data) {
          this.equipmentData = resp.data.data;
        }
      }
      catch (error) { }
    },
    async getPay_materialData() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/data-items/raw-material-funds-name/detail',
        });
        if (resp.data.data) {
          this.materialData = resp.data.data;
        }
      }
      catch (error) { }
    },
    async getPay_serveData() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/data-items/server-funds-name/detail',
        });
        if (resp.data.data) {
          this.serveData = resp.data.data;
        }
      }
      catch (error) { }
    },
    
    async getPay_apply_depart_idOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/companies/departments/tree',
        });
        if (resp.data) {
          let {
            data
          } = resp.data
          this.pay_apply_depart_idOptions = this.formatTree(data, 'F_DepartmentId', 'F_FullName',
            'children', 1);
        }
      }
      catch (error) { }
    },
    async getPay_patternOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/data-items/sdfzffs/detail',
        });
        if (resp.data.data) {
          this.pay_patternOptions = resp.data.data;
        }
      }
      catch (error) { }
    },
    async getProject_nameOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url: baseUrl + '/data-items/zffs/detail',
        });
        if (resp.data.data) {
          this.project_nameOptions = resp.data.data;
        }
      }
      catch (error) { }
    },
    //子表单权限
    getAuthorityTableChildrenList(bindTable, children) {
      let column = [];
      if (bindTable && this.formEnCodeList && this.formEnCodeList[bindTable]) {
        let formSubEnCodeList = this.formEnCodeList[bindTable];
        if (children && children.length > 0) {
          column = children.map(ele2 => {
            if (formSubEnCodeList.includes(ele2.prop)) {
              ele2.hide = false;
            }
            else {
              ele2.hide = true;
            }
            if (ele2.hide == false) {
              //工作流中系统表单必填权限
              if (this.formSubTableNotRequiredList[bindTable] != undefined) {
                if (this.formSubTableNotRequiredList[bindTable].includes(ele2.prop)) {
                  ele2.required = false;
                }
                else {
                  ele2.required = true;
                }
              }
              ele2.rules = [];
              if (ele2.required) {
                ele2.rules = ele2.ruleList;
              }
              // disabled 属性
              if (this.formSubTableDisabledList[bindTable] != undefined) {
                if (this.formSubTableDisabledList[bindTable].includes(ele2.prop)) {
                  ele2.disabled = true;
                }
                else {
                  ele2.disabled = false;
                }
              }
            }
            return ele2;
          });
        }
        return column;
      }
      else {
        return children;
      }
    },
    getFormConfig() {
      let config = {
        "fields": [{
          "__vModel__": "field100e424",
          "__config__": {
            "label": "付款申请",
            "showLabel": false,
            "titleColor": null,
            "fontSize": null,
            "tag": "h2",
            "span": 24,
            "align": "top",
            "justify": "start",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 100
          }
        }, {
          "__vModel__": "job",
          "__config__": {
            "label": "职级名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 101,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "job",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "role_id",
          "__config__": {
            "label": "角色ID",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 102,
            "fieldLength": "500",
            "bindTable": "pay_apply",
            "bindTableField": "role_id",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "role_name",
          "__config__": {
            "label": "角色名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 103,
            "fieldLength": 500,
            "bindTable": "pay_apply",
            "bindTableField": "role_name",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "area",
          "__config__": {
            "label": "地区",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 104,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "area",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "user_id",
          "__config__": {
            "label": "申请人ID",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 105,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "user_id",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "apply_time",
          "__type__": "info",
          "infoType": "date",
          "__organize__": true,
          "__config__": {
            "label": "申请时间",
            "showLabel": true,
            "tag": "avue-information-body",
            "avueType": "information-body",
            "defaultValue": "2022-07-07 11:02:33",
            "required": false,
            "span": 24,
            "whetherToRebindSecondaryEditing": false,
            "bindTableField": "apply_time",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 106,
            "placeholder": "当前时间",
            "fieldLength": 500,
            "bindTable": "pay_apply",
            "bindTableFieldType": "datetime"
          }
        }, {
          "__vModel__": "user_name",
          "__config__": {
            "label": "申请人名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 107,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "user_name",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "depart_short_name",
          "__config__": {
            "label": "部门简称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 108,
            "fieldLength": "200",
            "bindTable": "pay_apply",
            "bindTableField": "depart_short_name",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "depart_id",
          "__config__": {
            "label": "部门",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 109,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "depart_id",
            "bindTableFieldType": "varchar"
          }

        },
        //支付公司
          {
            "__vModel__": "F_payment_company",
            "__config__": {
              "label": "支付公司",
              "showLabel": true,
              "required": false,
              "tag": "avue-input-tree",
              "dataKey": "data",
              "span": 24,
              "bindTableField": "F_payment_company",
              "F_LgMarkCode": "",
              "prestrainField": "",
              "formId": 143,
              "fieldLength": "50",
              "bindTable": "pay_apply",
              "bindTableFieldType": "varchar"
            }
          },
        {
          "__vModel__": "current_user_id",
          "__type__": "info",
          "infoType": "user",
          "__organize__": true,
          "__config__": {
            "label": "当前用户",
            "showLabel": true,
            "tag": "avue-information-body",
            "avueType": "information-body",
            "defaultValue": "316231f32f1f0e5a4c56bf855806b924",
            "required": false,
            "span": 24,
            "whetherToRebindSecondaryEditing": false,
            "bindTableField": "current_user_id",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 110,
            "placeholder": "当前用户",
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "is_effective",
          "__config__": {
            "label": "是否生效",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 111,
            "fieldLength": "1",
            "bindTable": "pay_apply",
            "bindTableField": "is_effective",
            "bindTableFieldType": "int"
          }
        }, {
          "__vModel__": "pay_source",
          "__config__": {
            "label": "支付来源",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 113,
            "dataType": "dataItem",
            "dataItem": "zfly",
            "fieldLength": "20",
            "bindTable": "pay_apply",
            "bindTableField": "pay_source",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "number",
          "__vModel__": "pay_money",
          "computationalConfiguration": [],
          "append": "元",
          "__config__": {
            "label": "付款金额",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input",
            "defaultValue": 0,
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 114,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "pay_money",
            "bindTableFieldType": "double"
          }
        }, 
        // F_contract_amount
        {
          "tempType": "number",
          "__vModel__": "F_contract_amount",
          "computationalConfiguration": [],
          "append": "元",
          "__config__": {
            "label": "合同金额",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input",
            "defaultValue": 0,
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 124,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "F_contract_amount",
            "bindTableFieldType": "double"
          }
        }, 
        
        {
          "__vModel__": "pay_type",
          "__config__": {
            "label": "付款类型",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 115,
            "dataType": "dataItem",
            "dataItem": "fklx",
            "defaultValue": "2",
            "fieldLength": "20",
            "bindTable": "pay_apply",
            "bindTableField": "pay_type",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "tree",
          "__vModel__": "pay_apply_depart_id",
          "__type__": "department",
          "__organize__": true,
          "__config__": {
            "label": "付款申请部门",
            "showLabel": true,
            "required": false,
            "tag": "avue-input-tree",
            "dataKey": "data",
            "span": 24,
            "bindTableField": "pay_apply_depart_id",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 116,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "pay_apply_user_id",
          "__type__": "user",
          "__organize__": true,
          "suffix-icon": "el-icon-setting",
          "__config__": {
            "label": "付款申请人",
            "showLabel": true,
            "tag": "xjr-select-user",
            "saveValue": "",
            "required": false,
            "span": 24,
            "bindTableField": "pay_apply_user_id",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 117,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "project_id",
          "__config__": {
            "label": "招标项目选择",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 118,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "project_id",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "file_url",
          "__config__": {
            "label": "签署版合同/验收文件",
            "tag": "el-upload",
            "avueType": "upload",
            "defaultValue": null,
            "showLabel": true,
            "required": true,
            "span": 24,
            "showTip": false,
            "buttonText": "点击上传",
            "fileSize": 2,
            "sizeUnit": "MB",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 119,
            "fieldLength": 2000,
            "bindTable": "pay_apply",
            "bindTableField": "file_url",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "receive_count",
          "__config__": {
            "label": "收款账户",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 121,
            "fieldLength": "500",
            "bindTable": "pay_apply",
            "bindTableField": "receive_count",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "other_desc",
          "__config__": {
            "label": "其他说明",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 122,
            "fieldLength": "2000",
            "bindTable": "pay_apply",
            "bindTableField": "other_desc",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "pay_pattern",
          "__config__": {
            "label": "支付方式",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 123,
            "dataType": "dataItem",
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "pay_pattern",
            "bindTableFieldType": "varchar",
            "dataItem": "sdfzffs"
          }
        }, {
          "__vModel__": "notice_card_file_url",
          "__config__": {
            "label": "缴费通知单",
            "tag": "el-upload",
            "avueType": "upload",
            "defaultValue": null,
            "showLabel": true,
            "required": true,
            "span": 24,
            "showTip": false,
            "buttonText": "点击上传",
            "fileSize": 2,
            "sizeUnit": "MB",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 124,
            "fieldLength": 2000,
            "bindTable": "pay_apply",
            "bindTableField": "notice_card_file_url",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "use_scope",
          "__config__": {
            "label": "适用范围",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 125,
            "dataType": "dataItem",
            "dataItem": "syfw",
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "use_scope",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "pay_contract_id",
          "__config__": {
            "label": "付款合同",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 126,
            "fieldLength": "50",
            "bindTable": "pay_apply",
            "bindTableField": "pay_contract_id",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "project_name",
          "__config__": {
            "label": "款项名称",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 128,
            "dataType": "dataItem",
            "dataItem": "zffs",
            "fieldLength": 500,
            "bindTable": "pay_apply",
            "bindTableField": "project_name",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "textarea",
          "__vModel__": "project_reason",
          "__config__": {
            "label": "付款事由",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "textarea",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 129,
            "fieldLength": 2000,
            "bindTable": "pay_apply",
            "bindTableField": "project_reason",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "project_files",
          "__config__": {
            "label": "项目资料文件",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 130,
            "fieldLength": "2000",
            "bindTable": "pay_apply",
            "bindTableField": "project_files",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "electronic_invoice",
          "__config__": {
            "label": "电子发票",
            "showLabel": true,
            "tag": "el-upload",
            "avueType": "upload",
            "required": true,
            "span": 24,
            "buttonText": "点击上传",
            "fileSize": 2,
            "sizeUnit": "MB",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 131,
            "fieldLength": 2000,
            "bindTable": "pay_apply",
            "bindTableField": "electronic_invoice",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "receive_ticket_manager",
          "__config__": {
            "label": "收票管理",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 132,
            "fieldLength": 500,
            "bindTable": "pay_apply",
            "bindTableField": "receive_ticket_manager",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "textarea",
          "__vModel__": "field1200cc4",
          "__type__": "opinion",
          "__config__": {
            "label": "意见簿",
            "showLabel": true,
            "tag": "xjr-opinion-comonent",
            "defaultValue": null,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 120
          }
        }]
      };
      return config;
    },
    // 招标项目选择
    selectApprovalForm1() {
      this.approvalFormVisible = true
      this.$nextTick(()=>{
        this.$refs.approval.init()
      })
    },
    selectContract(){

    },
    selectApprovalForm2(){
      this.approvalFormVisible2 = true
      this.$nextTick(()=>{
        this.$refs.approval2.init()
      })
    },
    selectApprovalForm3(){
      this.approvalFormVisible3 = true
    },
    sure(v) {
      this.approvalFormVisible = false
      if (v == 'del') {
        this.formData['project_id'] = ''
      }
      this.$refs.approval.historyTaskData = this.$refs.approval.historyTaskData.filter(e => e.isChecked)
      this.$refs.approval.myTaskData = this.$refs.approval.myTaskData.filter(e => e.isChecked)
      this.$refs.approval.manualTaskData = this.$refs.approval.manualTaskData.filter(e => e.isChecked)
      setTimeout(() => {
        if (this.$refs.approval.historyTaskData && this.$refs.approval.historyTaskData.length > 0) {
          this.$refs.approval.historyTaskData.forEach(element => {
            this.formData['project_id'] += element.processInstanceId
          })
        }
        if (this.$refs.approval.myTaskData && this.$refs.approval.myTaskData.length > 0) {
          this.$refs.approval.myTaskData.forEach(element => {
            this.formData['project_id'] += element.processInstanceId
          })
        }
        if (this.$refs.approval.manualTaskData && this.$refs.approval.manualTaskData.length > 0) {
          this.$refs.approval.manualTaskData.forEach(element => {
            this.formData['project_id'] += element.processInstanceId
          })
        }
        this.selectData = [...this.$refs.approval.historyTaskData, ...this.$refs.approval.myTaskData, ...this.$refs.approval.manualTaskData]
        
      }, 500);
    },
    delApproval(item, index) {
      if (this.$refs.approval.historyTaskData.includes(item)) {
        this.$refs.approval.historyTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval.historyTaskData.splice(i, 1)
          }
        })
      }
      if (this.$refs.approval.myTaskData.includes(item)) {
        this.$refs.approval.myTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval.myTaskData.splice(i, 1)
          }
        })
      }
      if (this.$refs.approval.manualTaskData.includes(item)) {
        this.$refs.approval.manualTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval.manualTaskData.splice(i, 1)
          }
        })
      }
      this.sure('del')
    },
    /**
     * 付款合同
     */
    sure2(v) {
      if (v == 'del') {
        this.formData['pay_contract_id'] = ''
      }
      this.$refs.approval2.historyTaskData = this.$refs.approval2.historyTaskData.filter(e => e.isChecked)
      this.$refs.approval2.myTaskData = this.$refs.approval2.myTaskData.filter(e => e.isChecked)
      this.$refs.approval2.manualTaskData = this.$refs.approval2.manualTaskData.filter(e => e.isChecked)
      setTimeout(() => {
        if (this.$refs.approval2.historyTaskData && this.$refs.approval2.historyTaskData.length > 0) {
          this.$refs.approval2.historyTaskData.forEach(element => {
            this.formData['pay_contract_id'] += element.processInstanceId 
          })
        }
        if (this.$refs.approval2.myTaskData && this.$refs.approval2.myTaskData.length > 0) {
          this.$refs.approval2.myTaskData.forEach(element => {
            this.formData['pay_contract_id'] += element.processInstanceId 
          })
        }
        if (this.$refs.approval2.manualTaskData && this.$refs.approval2.manualTaskData.length > 0) {
          this.$refs.approval2.manualTaskData.forEach(element => {
            this.formData['pay_contract_id'] += element.processInstanceId 
          })
        }
        this.selectData2 = [...this.$refs.approval2.historyTaskData, ...this.$refs.approval2.myTaskData, ...this.$refs.approval2.manualTaskData]
        this.approvalFormVisible2 = false
      }, 0);
    },
    delApproval2(item, index) {
      if (this.$refs.approval2.historyTaskData.includes(item)) {
        this.$refs.approval2.historyTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval2.historyTaskData.splice(i, 1)
          }
        })
      }
      if (this.$refs.approval2.myTaskData.includes(item)) {
        this.$refs.approval2.myTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval2.myTaskData.splice(i, 1)
          }
        })
      }
      if (this.$refs.approval2.manualTaskData.includes(item)) {
        this.$refs.approval2.manualTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval2.manualTaskData.splice(i, 1)
          }
        })
      }
      this.sure2('del')
    },
    // end
    /**
     * 项目资料文件
     */
    sure3(v) {
      if (v == 'del') {
        this.formData['project_files'] = ''
      }
      this.$refs.approval3.historyTaskData = this.$refs.approval3.historyTaskData.filter(e => e.isChecked)
      this.$refs.approval3.myTaskData = this.$refs.approval3.myTaskData.filter(e => e.isChecked)
      this.$refs.approval3.manualTaskData = this.$refs.approval3.manualTaskData.filter(e => e.isChecked)
      setTimeout(() => {
        if (this.$refs.approval3.historyTaskData && this.$refs.approval3.historyTaskData.length > 0) {
          this.$refs.approval3.historyTaskData.forEach(element => {
            this.formData['project_files'] += element.processInstanceId 
          })
        }
        if (this.$refs.approval3.myTaskData && this.$refs.approval3.myTaskData.length > 0) {
          this.$refs.approval3.myTaskData.forEach(element => {
            this.formData['project_files'] += element.processInstanceId 
          })
        }
        if (this.$refs.approval3.manualTaskData && this.$refs.approval3.manualTaskData.length > 0) {
          this.$refs.approval3.manualTaskData.forEach(element => {
            this.formData['project_files'] += element.processInstanceId 
          })
        }
        this.selectData3 = [...this.$refs.approval3.historyTaskData, ...this.$refs.approval3.myTaskData, ...this.$refs.approval3.manualTaskData]
        this.approvalFormVisible3 = false
      }, 0);
    },
    delApproval3(item, index) {
      if (this.$refs.approval3.historyTaskData.includes(item)) {
        this.$refs.approval3.historyTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval3.historyTaskData.splice(i, 1)
          }
        })
      }
      if (this.$refs.approval3.myTaskData.includes(item)) {
        this.$refs.approval3.myTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval3.myTaskData.splice(i, 1)
          }
        })
      }
      if (this.$refs.approval3.manualTaskData.includes(item)) {
        this.$refs.approval3.manualTaskData.forEach((e, i) => {
          if (e == item) {
            this.$refs.approval3.manualTaskData.splice(i, 1)
          }
        })
      }
      this.sure3('del')
    },
    // end
    // 收票管理
    sendData(val) {
      this.formData['receive_ticket_manager'] = val.processInstanceId
      this.dataVal = val
    },
    sureVoice() {
      this.setPeojectDialogVisible = false
    },
    delVoice() {
      this.formData['receive_ticket_manager'] = ''
      this.dataVal = {}
    },
    transmissionData(value){
      this.formData['pay_apply_user_id'] = value
    },
    // end
    selectType(){
      // 适用范围
      if(this.formData['pay_type'] == 1){//投标保证金
        this.toubiaoFlag = false
      }else{
        this.toubiaoFlag = true
      }
      // 工程款项名称
      if(this.formData['pay_type'] == 3){//工程合同款
        this.projectFlag = true
      }else{
        this.projectFlag = false
      }
      // 设备款项名称
      if(this.formData['pay_type'] == 4){//设备合同款
        this.equipmentFlag = true
      }else{
        this.equipmentFlag = false
      }
      // 原材料款项名称
      if(this.formData['pay_type'] == 5){//原材料合同款
        this.originalMateriaFlag = true
      }else{
        this.originalMateriaFlag = false
      }
      // 原材料款项名称
      if(this.formData['pay_type'] == 7){//服务合同款
        this.serveContractFlag = true
      }else{
        this.serveContractFlag = false
      }



      
      
      
      if(this.formData['pay_type'] == 2){
        console.log('水电费');
      }else if(this.formData['pay_type'] == 3){
        console.log('工程合同款');
      }else if(this.formData['pay_type'] == 4){
        console.log('设备合同款');
      }else if(this.formData['pay_type'] == 5){
        console.log('原材料合同款');
      }else if(this.formData['pay_type'] == 6){
        console.log('耗材/劳保合同款');
      }else if(this.formData['pay_type'] == 7){
        console.log('服务合同款');
      }else if(this.formData['pay_type'] == 9){
        console.log('专利相关服务费');
      }
    }
  }
}
</script>
<style>
.el-table__empty-block {
  width: 100% !important;
}

.avue-form__row {
  padding: 0 !important;
}

#editorphone {
  width: 375px;
  margin: 0 auto;
  border: 1px solid #E4E7ED;
  padding: 0 7.5px;
  background: #f5f6fa;
  height: 700px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 5px;
}

#editorphone .el-col {
  border-bottom: 1px solid #F2F2F2;
  background: #fff;
  margin-bottom: 0;
  padding: 0 15px 6px !important;
  width: 100%;
}

#editorphone .el-form-item__label {
  line-height: 20px
}

#editorphone .el-input-group .el-input__inner {
  background: #f5f6fa
}

#editorphone .el-input__inner {
  border: 0
}

#editorphone .el-input-group__append,
#editorphone .el-input-group__prepend {
  border: 0;
  background: #edeef2;
  color: #666;
}

#editorphone .el-input-group .el-input__prefix {
  left: 44px
}

#editorphone .el-input-group .el-input__suffix {
  right: 44px
}

#editorphone .el-form-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-flow: wrap;
}

#editorphone .el-form-item__label {
  float: none;
  min-width: 85px;
  width: auto !important;
  text-align: left;
  flex: auto;
}

#editorphone .tinymce .el-form-item__label {
  min-width: 100%;
}

#editorphone .el-form-item__content {
  margin-left: 0px !important;
  flex: auto;
  width: calc(100% - 95px);
}
.del-items-middle{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editorphone .avueFormNoLable .el-form-item__label,
#editorphone .avueFormNoLable .avue-crud__pagination {
  display: none;
}

#editorphone .avueFormNoLable .el-collapse-item__wrap,
#editorphone .avueFormNoLable .el-collapse {
  border-bottom: 0
}

#editorphone .avueFormNoLable .el-col {
  border-bottom: 0;
  padding-bottom: 0
}

#editorphone .el-form-item__content .el-button:first-child {
  margin-left: 90px;
}

.el-upload__tip {
  line-height: 1.2;
}
.upload-demo{
  width: 400px;
}

.upload-demo{
  width: 400px;
}
.table-header-items{
  border: 1px solid #DCDFE6;
  text-align: center;
}
.width100{
  width: 100px;
}
.width200{
  width: 13%;
}
.required{
  color:#FE6350;
  position: relative;
  top: 3px;
  right: 3px;
}
.el-inputs_{
  text-align: center;
}
.marginleft{
  margin-left: -100px;
}

.left1{
  width: 50%;
  height: 100%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.right1{
  width: 50%;
  height: 100%;
  text-align: center;
}
.right1 > img{
  width: 100%;
  width: 42.5px;
  height: 37px;
}
.flex_1{
  display: flex;
  flex-direction: row;
}
.textaligncenter{
  text-align: center;
}
.table-box{
  width: 1600px;
}
</style>
